package com.example.lin.utils;

import com.example.lin.enums.ResultEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResultTest {
    private Integer code;

    private String message;


    private Object data;

    public static ResultTest success(ResultEnum resultEnum, Object data) {
        return new ResultTest(resultEnum.getCode(), resultEnum.getMessage(), data);
    }

    public static ResultTest success(ResultEnum resultEnum) {
        return new ResultTest(resultEnum.getCode(), resultEnum.getMessage(), null);
    }

    public static ResultTest fail(ResultEnum resultEnum) {
        return new ResultTest(resultEnum.getCode(), resultEnum.getMessage(), null);
    }
}
